package flown.window.graphics.ui.event;

import flown.window.graphics.ui.Widget;

/**
 * @author flown
 */

public class Event
{
    private final Widget widget;
    private final java.awt.Point mouse_location_position;

    public static int NONE = 0;

    public Event(Widget widget) { this(widget,null); }
    public Event(Widget widget, java.awt.Point mouse_position)
    {
        this.widget = widget;
        this.mouse_location_position = mouse_position;
    }

    public final int GetX() { return this.widget.GetX(); }
    public final int GetY() { return this.widget.GetY(); }
    public final int GetWidth() { return this.widget.GetWidth(); }
    public final int GetHeight() { return this.widget.GetHeight(); }
    public final int GetMouseX() { return java.awt.MouseInfo.getPointerInfo().getLocation().x; }
    public final int GetMouseY() { return java.awt.MouseInfo.getPointerInfo().getLocation().y; }
    public final int GetLocationMouseX()
    {
        if(this.mouse_location_position != null)
            return this.mouse_location_position.x;
        return flown.window.graphics.ui.event.Event.NONE;
    }
    public final int GetLocationMouseY()
    {
        if(this.mouse_location_position != null)
            return this.mouse_location_position.y;
        return flown.window.graphics.ui.event.Event.NONE;
    }
}


